Skip to content

Add the ability to add an app shortcut to open chuck from the launcher icon#49

Open
degill wants to merge 1 commit intojgilfelt:masterfrom
degill:dg_app_shortcut
Open

Add the ability to add an app shortcut to open chuck from the launcher icon#49
degill wants to merge 1 commit intojgilfelt:masterfrom
degill:dg_app_shortcut

Conversation

@degill
Copy link
Copy Markdown

@degill degill commented May 25, 2017

This commit adds the ability to add an app shortcut to the clients' launcher icon on android devices running android 7.0 and above. With that app shortcut the Chuck UI can be accessed. This can be useful if no notification is desired but there still need to be a simple way to enter chuck.

@degill degill changed the title Add the ability to add app shortcuts to open chuck Add the ability to add app shortcut to open chuck May 25, 2017
@degill degill changed the title Add the ability to add app shortcut to open chuck Add the ability to add an app shortcut to open chuck from the launcher icon May 25, 2017
Copy link
Copy Markdown

@olivierperez olivierperez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should maybe add a method to remove the shortcut too.

final String id = context.getPackageName() + ".chuck_ui";
final ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
final ShortcutInfo shortcut = new ShortcutInfo.Builder(context, id).setShortLabel("Chuck")
.setLongLabel("Open Chuck UI")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The label should be retrieved from the resources, or maybe given by paramters to let de developer choose the wording.

* It can be used if you want to remove this shortcut later on.
*/
@TargetApi(Build.VERSION_CODES.N_MR1)
@SuppressWarnings("WeakerAccess")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not fan of this SuppressWarnings

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is obviously not called from within the library, thus there will be a warning that its access can be weaker, but apps need access to it so it must be public -> Get rid of the warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants